import java.util.Scanner;

public class PrimeNumbers {
    public static void main(String[] args) {
        int count = 0;
        for (int i = 2; i <= 20000; i++) {
            if (isPrime(i)) {
                System.out.printf("%-6d", i);
                count++;
                if (count % 20 == 0) {
                    System.out.println();
                }
            }
        }
    }
    private static boolean isPrime(int n) {
        if (n <= 1) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;  // 偶数直接排除
        // 仅判断奇数，且上限为√n
        for (int i = 3; i <= Math.sqrt(n); i += 2) {
            if (n % i == 0) return false;
        }
        return true;
    }
}